package fmod.org.smali.myapplication.activitys;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;


public class MainActivity extends ListActivity {
    public static String[] names = new String[]{
        "ShareDemoFragment","DragableViewFragment","PlayerFragment","ScrollerLayoutFragment",
            "GestureTest",
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, names);
        setListAdapter(stringArrayAdapter);

        getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(MainActivity.this, DetailActivity.class);
                intent.putExtra("itemName", names[position]);
                startActivity(intent);
            }
        });
    }
}
